/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.recent;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "recent_obj_etflist")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RecentObjETFList.findAll", query = "SELECT r FROM RecentObjETFList r"),
    @NamedQuery(name = "RecentObjETFList.findById", query = "SELECT r FROM RecentObjETFList r WHERE r.id = :id"),
    @NamedQuery(name = "RecentObjETFList.findByEtfid", query = "SELECT r FROM RecentObjETFList r WHERE r.etfid = :etfid"),
    @NamedQuery(name = "RecentObjETFList.findByListingDate", query = "SELECT r FROM RecentObjETFList r WHERE r.listingDate = :listingDate"),
    @NamedQuery(name = "RecentObjETFList.findByObj", query = "SELECT r FROM RecentObjETFList r WHERE r.obj = :obj"),
    @NamedQuery(name = "RecentObjETFList.findByMarketCode", query = "SELECT r FROM RecentObjETFList r WHERE r.marketCode = :marketCode"),
    @NamedQuery(name = "RecentObjETFList.findByClassCode", query = "SELECT r FROM RecentObjETFList r WHERE r.classCode = :classCode"),
    @NamedQuery(name = "RecentObjETFList.findByQty", query = "SELECT r FROM RecentObjETFList r WHERE r.qty = :qty"),
    @NamedQuery(name = "RecentObjETFList.findByCanCashRepl", query = "SELECT r FROM RecentObjETFList r WHERE r.canCashRepl = :canCashRepl"),
    @NamedQuery(name = "RecentObjETFList.findByCashBuffer", query = "SELECT r FROM RecentObjETFList r WHERE r.cashBuffer = :cashBuffer"),
    @NamedQuery(name = "RecentObjETFList.findByCashAmount", query = "SELECT r FROM RecentObjETFList r WHERE r.cashAmount = :cashAmount"),
    @NamedQuery(name = "RecentObjETFList.findByReMark", query = "SELECT r FROM RecentObjETFList r WHERE r.reMark = :reMark"),
    @NamedQuery(name = "RecentObjETFList.findByOwnUserID", query = "SELECT r FROM RecentObjETFList r WHERE r.ownUserID = :ownUserID"),
    @NamedQuery(name = "RecentObjETFList.findByAlterUserID", query = "SELECT r FROM RecentObjETFList r WHERE r.alterUserID = :alterUserID"),
    @NamedQuery(name = "RecentObjETFList.findByCreateTime", query = "SELECT r FROM RecentObjETFList r WHERE r.createTime = :createTime"),
    @NamedQuery(name = "RecentObjETFList.findByTimeStamp", query = "SELECT r FROM RecentObjETFList r WHERE r.timeStamp = :timeStamp")})
public class RecentObjETFList implements Serializable {
	public static byte[] EnCode(RecentObjETFList msg) throws IOException {
		Codec<RecentObjETFList> Lcode = ProtobufProxy.create(RecentObjETFList.class);
		return Lcode.encode(msg);
	}
	public static RecentObjETFList DeCode(byte[] data) throws IOException {
	Codec<RecentObjETFList> Lcode = ProtobufProxy.create(RecentObjETFList.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "ETFID")
    @Protobuf
	private String etfid;
    @Basic(optional = false)
    @Column(name = "ListingDate")
    @Temporal(TemporalType.DATE)
    private Date listingDate;
	@Protobuf
	private long listingDateL;
    @Basic(optional = false)
    @Column(name = "Obj")
    @Protobuf
	private String obj;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Basic(optional = false)
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Column(name = "Qty")
    @Protobuf
	private Integer qty;
    @Column(name = "CanCashRepl")
    @Protobuf
	private String canCashRepl;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "CashBuffer")
    @Protobuf
	private Float cashBuffer;
    @Column(name = "CashAmount")
    @Protobuf
	private Float cashAmount;
    @Column(name = "ReMark")
    private String reMark;
	@Protobuf
	private byte[] reMarkBit;
    @Column(name = "OwnUserID")
    @Protobuf
	private String ownUserID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public RecentObjETFList() {
    }

    public RecentObjETFList(Integer id) {
        this.id = id;
    }

    public RecentObjETFList(Integer id, String etfid, Date listingDate, String obj, String marketCode, String classCode) {
        this.id = id;
        this.etfid = etfid;
        this.listingDate = listingDate;
		this.listingDateL = CodeTool.DateToLong(listingDate);
        this.obj = obj;
        this.marketCode = marketCode;
        this.classCode = classCode;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getEtfid() {
        return etfid;
    }

    public void setEtfid(String etfid) {
        this.etfid = etfid;
    }

    public Date getListingDate() {
        return listingDate;
    }

    public void setListingDate(Date listingDate) {
        this.listingDate = listingDate;
        this.setListingDateL(CodeTool.DateToLong(listingDate));
    }

    public String getObj() {
        return obj;
    }

    public void setObj(String obj) {
        this.obj = obj;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public Integer getQty() {
        return qty;
    }

    public void setQty(Integer qty) {
        this.qty = qty;
    }

    public String getCanCashRepl() {
        return canCashRepl;
    }

    public void setCanCashRepl(String canCashRepl) {
        this.canCashRepl = canCashRepl;
    }

    public Float getCashBuffer() {
        return cashBuffer;
    }

    public void setCashBuffer(Float cashBuffer) {
        this.cashBuffer = cashBuffer;
    }

    public Float getCashAmount() {
        return cashAmount;
    }

    public void setCashAmount(Float cashAmount) {
        this.cashAmount = cashAmount;
    }

    public String getReMark() {
        return reMark;
    }

    public void setReMark(String reMark) {
        this.reMark = reMark;
		this.setReMarkBit(CodeTool.StringToBit(reMark));
    }

    public String getOwnUserID() {
        return ownUserID;
    }

    public void setOwnUserID(String ownUserID) {
        this.ownUserID = ownUserID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RecentObjETFList)) {
            return false;
        }
        RecentObjETFList other = (RecentObjETFList) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.recent.RecentObjETFList[ id=" + id + " ]";
    }

    public long getListingDateL() {
        return listingDateL;
    }

    public void setListingDateL(long listingDateL) {
        this.listingDateL = listingDateL;
		this.listingDate = CodeTool.LongToDate(listingDateL);
    }

    public byte[] getReMarkBit() {
        return reMarkBit;
    }

    public void setReMarkBit(byte[] reMarkBit) {
        this.reMarkBit = reMarkBit;
		this.reMark = CodeTool.BitToString(reMarkBit);
    }
    
}
